#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys, datetime, os
import json

from xpy3lib.utils import db_utils as util
from xpy3lib.XLogger import XLogger
from xpy3lib.utils.XUtils import XUtils


def main():
    profile = (sys.argv[1].split("=", 1)[-1]) if len(sys.argv) > 1 else 'prod'
    run_immediately = (sys.argv[2].split("=", 1)[-1] == '1') if len(sys.argv) > 2 else False

    from sicut.bootstrap import run

    status = run(profile=profile, run_immediately=run_immediately)
    return status


if __name__ == '__main__':
    start = datetime.datetime.now()

    status = main()

    elapsed = float((datetime.datetime.now() - start).seconds)
    print("Time Used 4 All ----->>>> %f seconds" % (elapsed))

    sys.exit(status)
